搭建安全Docker Registry

1.安装registry
docker pull registry

2.制作证书
openssl req -newkey rsa:2048 -nodes -sha256 -keyout certs/domain.key -x509 -days 365 -out certs/domain.crt

image

3.docker run -d -p 5000:5000 --restart=always --name registry \
  -v /data/registry:/var/lib/registry \
  -v /certs:/certs \
  -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
  -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \

.4.在客户端安装证书
sudo mkdir -p /etc/docker/certs.d/d.img.hysyeah.top:5000
sudo cp domain.crt /etc/docker/certs.d/d.img.hysyeah.top:5000/ca.crt
sudo service docker restart

5.docker pull busybox

6.docker tag busybox d.img.hysyeah.top:5000/busybox 

7.docker push d.img.hysyeah.top:5000/busybox